package org.box.metadata.shell.web;

public enum ConcurrentSessionPolicy {
	
	GLOBAL_SESSION ("global-session", "gs"),
	REJECT_NEW_SESSION ("reject-new-session", "rns"),
	CONCURRENT_SESSIONS ("concurrent-sessions", "css");
	
	private final String fullName;
	private final String shortName;

	ConcurrentSessionPolicy(String fullName, String shortName) {
		this.fullName = fullName;
		this.shortName = shortName;
	}

	public String getFullName() {
		return fullName;
	}

	public String getShortName() {
		return shortName;
	}

	public static ConcurrentSessionPolicy findByNames(String fullOrShortName) {
		for (ConcurrentSessionPolicy csp : values()) {
			if (csp.fullName.equalsIgnoreCase(fullOrShortName)
					|| csp.shortName.equalsIgnoreCase(fullOrShortName)) 
				return csp;
		}
		return null;
	}
	
}
